package storage;

import java.awt.Dimension;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;

public class Rule {
	// Each rule will form a sentence
	// Mark if field subjectField is value equality targetField connector
	public String field ="";
	public boolean active = true;
	public String subjectField ="";
	public String value ="";
	public String equality ="";
	public String targetField ="";
	public int groupNo =1;
	public String connector = "";
	
	//Used for display purposes
	public JCheckBox checkBox;
	public JLabel label;
	public JButton button;
	
	public Rule(String field){
		this.field = field;
		checkBox = new JCheckBox("Check field");
		label = new JLabel(field);
		button = new JButton("Edit Rules");
		button.setPreferredSize(new Dimension(100,20));
	}
	public Rule(String field, boolean active, String subjectField, String value, String equality,
			String targetField, int groupNo, String connector){
		this.field = field;
		this.active = active;
		this.subjectField = subjectField;
		this.value = value;
		this.equality = equality;
		this.targetField = targetField;
		this.groupNo = groupNo;
		this.connector = connector;
		
		checkBox = new JCheckBox();
//		checkBox.addActionListener(new ActionListener(){
//
//			@Override
//			public void actionPerformed(ActionEvent arg0) {
//				System.out.println("hit");
//				ProfileEditorGUI.activeList.put(field,checkBox.isSelected());
//			}
//			
//		});
		label = new JLabel(field);
		button = new JButton();
	}
	public Rule clone(){
		return new Rule(this.field, this.active, subjectField, this.value, this.equality,
				this.targetField, this.groupNo, this.connector);
	}
}
